package com.itheima.try1try;

class Person {
    private String name;
    private int age;

    public Person() {
        this("匿名", 6);
    }

    public Person(String name) {
        this(name, 6);
    }

    public Person(String name, int age) {
        this.name = name;
        this.age = age;
    }

    @Override
    public String toString() {
        return "Person{" +
                "name='" + name + '\'' +
                ", age=" + age +
                '}';
    }
}

public class Task {

    public static void main(String[] args) {
        Person person1 = new Person("小明", 32);
        Person person2 = new Person("小明"); // 这里会将6作为age默认值
        Person person3 = new Person(); // 这里会将"匿名"作为name、6作为age

        System.out.println(person1);
        System.out.println(person2);
        System.out.println(person3);
    }

}
